package com.metier;

import java.io.Serializable;


/**
 * This is an object that contains data related to the type_contexte table.
 * Do not modify this class because it will be overwritten if the configuration file
 * related to this class is modified.
 *
 * @hibernate.class
 *  table="type_contexte"
 */

public abstract class BaseTypeContexte  implements Serializable {

	public static String REF = "TypeContexte";
	public static String PROP_NOM = "Nom";
	public static String PROP_ID = "Id";


	// constructors
	public BaseTypeContexte () {
		initialize();
	}

	/**
	 * Constructor for primary key
	 */
	public BaseTypeContexte (java.lang.Integer id) {
		this.setId(id);
		initialize();
	}

	/**
	 * Constructor for required fields
	 */
	public BaseTypeContexte (
		java.lang.Integer id,
		java.lang.String nom) {

		this.setId(id);
		this.setNom(nom);
		initialize();
	}

	protected void initialize () {}



	private int hashCode = Integer.MIN_VALUE;

	// primary key
	private java.lang.Integer id;

	// fields
	private java.lang.String nom;

	// collections
	private java.util.Set<com.metier.Contexte> contextes;



	/**
	 * Return the unique identifier of this class
     * @hibernate.id
     *  generator-class="sequence"
     *  column="id_type"
     */
	public java.lang.Integer getId () {
		return id;
	}

	/**
	 * Set the unique identifier of this class
	 * @param id the new ID
	 */
	public void setId (java.lang.Integer id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}




	/**
	 * Return the value associated with the column: nom
	 */
	public java.lang.String getNom () {
		return nom;
	}

	/**
	 * Set the value related to the column: nom
	 * @param nom the nom value
	 */
	public void setNom (java.lang.String nom) {
		this.nom = nom;
	}



	/**
	 * Return the value associated with the column: Contextes
	 */
	public java.util.Set<com.metier.Contexte> getContextes () {
		return contextes;
	}

	/**
	 * Set the value related to the column: Contextes
	 * @param contextes the Contextes value
	 */
	public void setContextes (java.util.Set<com.metier.Contexte> contextes) {
		this.contextes = contextes;
	}

	public void addToContextes (com.metier.Contexte contexte) {
		if (null == getContextes()) setContextes(new java.util.TreeSet<com.metier.Contexte>());
		getContextes().add(contexte);
	}




	public boolean equals (Object obj) {
		if (null == obj) return false;
		if (!(obj instanceof com.metier.TypeContexte)) return false;
		else {
			com.metier.TypeContexte typeContexte = (com.metier.TypeContexte) obj;
			if (null == this.getId() || null == typeContexte.getId()) return false;
			else return (this.getId().equals(typeContexte.getId()));
		}
	}

	public int hashCode () {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId()) return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}


	public String toString () {
		return super.toString();
	}


}